<?php

interface Fruits{
    const MAX_WEIGHT = 5;  //定义一个静态常量
    function setName($name);
    function getName();
}

//实现接口
class Apple implements Fruits{
    private $name;
    public function getName() {
        return $this->name;
    }
    public function setName($_name) {
        return $this->name=$_name;
    }
}

$apple = new Apple();
$apple->setName("苹果");
echo "创建一个，".$apple->getName();
echo "<br />";
echo "MAX_GRADE is " . Apple::MAX_WEIGHT;   //使用静态常量
